package com.swh.qa.dao;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.NoRepositoryBean;

import java.util.List;
import java.util.Map;

/**
 * @Author: swh
 * @Description:
 * @Date: 2021/1/13 19:34
 * @Version: 1.0
 */
@NoRepositoryBean
public interface BaseDao<T> extends JpaRepository<T,String>, JpaSpecificationExecutor<T> {


    /**
     * sql查询
     *
     * @param sql
     * @param args
     * @return
     */
    List<Map> findAllByParams(String sql, Object... args);

    /**
     * sql分页查询
     *
     * @param sql
     * @param args
     * @return
     */
    Page<Map> findPageByParams(String sql, Pageable pageable, Object... args);


}
